<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="form" uri="/WEB-INF/tlds/hdiv-spring-form-3_0_4.tld"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<c:url value="selectDenominacion.html" var="seleccionarDenominacion"/>    
<script src="javascript/jquery.displaytag-ajax-1.2.js" type="text/javascript"></script>
  <script type="text/javascript">  
    $(function() {
        $('span.pagelinks>a, table#dispTable>thead>tr>th>a').live('click', function(){
            $.get($(this).attr('href'), function(responseText, status, xmlHttpRequest){
                $('#displayTagDiv').html($('#displayTagDiv', responseText).html());
                }
            )            
            return false;
        })
    });
   
    $(document).ready(function(){                
        $.getJSON("<c:url value='selecUnidMone.html'/>", {accion : "searchDesMod" },function(data){
            $("#desModulo").autocomplete({source:data});
        });        
        $("form").submit(function(){
            return false;
        });
        $("#desModulo").bestupper({
            clear:false
        });
        $("#mostrar").click(function(){ 
            $.get("<c:url value='selecUnidMone.html'/>",{accion:"buscarModulo",desModulo:$("#desModulo").val()}, function(responseText, status, xmlHttpRequest){
                $('#displayTagDiv').html($('#displayTagDiv', responseText).html());
                }
            )            
        });
        /*
        $("input[name$=chk]").click(function(){
            if($(this).is(":checked")){
                $.getJSON("<c:url value='selecUnidMone.html'/>", {accion : "selectCodModulo",codMat: $(this).val()});
            }else{
                $.getJSON("<c:url value='selecUnidMone.html'/>", {accion : "deselectCodCuenta",codMat: $(this).val()});
            }
        });      
        */
        $("#aceptar").click(function(){ 
            self.close();
        });  
        
    });
    function setChkDenos(codDenoVal,check){
        var idChkDeno = "#chkDeno"+codDenoVal;
        $.getJSON("<c:url value='mostrarHWF4001.html'/>",{ accion: "checkDeno", tipUnidMone: '<c:out value="${tipoUnidMone}"/>',codDeno: codDenoVal, isChecked: check.checked});
    }
    function setChkTodos(checkTodos){
        var booCheckTodos = "Check Object: "+ checkTodos.checked;
        $.get("<c:url value='selectDenominacion.html'/>",{accion:"selectTodos",tipUnidMone: '<c:out value="${tipoUnidMone}"/>',codTodos:checkTodos.checked}, function(responseText, status, xmlHttpRequest){
            $('#displayTagDiv').html($('#displayTagDiv', responseText).html());
            }
        )        
    }
  </script>
<body>
<form:form action="${seleccionarDenominacion}">
    <table id="fullheighttable" width="500" align="center">
        <tr>
            <td align="left" valign="top" class="fondo_modal padtop16left21">
                <table align="center">
                    <tr>
                        <td class="verdana11bazul">Denominaciones:</td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" style="color:red;font-weight:bold;text-align:left;">
                        Lista de Denominaciones
                        </td>
                    </tr>                    
                    <tr>
                        <td colspan="3">
                        <input type='checkbox' id='chkTodos' onclick='setChkTodos(this)'/> Todos  
                        <div id="displayTagDiv">
                        <display:table name="listDenominaciones" class="its" 
                                       pagesize="20" id="deno"
                                       requestURI="${seleccionarDenominacion}" >
                            
                            <display:column style="width:30px;text-align:left;" title="Sel">
                                <input type="checkbox" id="chkDeno{deno.codigo}" value="${deno.codigo}" onclick="setChkDenos('${deno.codigo}',this);" ${deno.chkMarca}/>
                            </display:column>
                            <display:column property="descripcion2" title="Tipo de Moneda"/>
                            <display:column property="descripcion" title="Denominacion"/>
                        </display:table>
                        </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">                
                            &nbsp;
                        </td>
                    </tr>                       
                    <tr>
                        <td colspan="3" align="center">                
                            <input type="button" value="Aceptar" id="aceptar" class="boton"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr><td>
            <div id="matrices"></div>
        </td></tr>
    </table>
</form:form>
</body>